package com.demo.services.impl;

import com.demo.database.data.TDemoDepartment;
import com.demo.database.data.TDemoEmployee;
import com.demo.database.data.TDemoPosition;
import com.demo.database.mapper.TDemoDepartmentMapper;
import com.demo.database.mapper.TDemoEmployeeMapper;
import com.demo.database.mapper.TDemoPositionMapper;
import com.demo.services.IEmployeeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.List;

/**
 * 员工管理业务实现接口的具体实现类
 * @cuthor luoxiaojiang
 * @createTime 2019年11月07日16:01:32
 * @Verson 1.0.0
 */
@Service
public class EmployeeServiceImpl implements IEmployeeService {

    @Resource
    private TDemoEmployeeMapper employeeMapper;
    @Resource
    private TDemoPositionMapper positionMapper;
    @Resource
    private TDemoDepartmentMapper departmentMapper;



    @Override
    public List<TDemoEmployee> employeeQuery(String context) throws Exception {
        List<TDemoEmployee> employeeList = employeeMapper.employeeQueryAllSql(context);
        return employeeList;
    }

    @Override
    public TDemoEmployee employeeQueryID(Integer employeeId) throws Exception {
        TDemoEmployee employee = employeeMapper.employeeQueryID(employeeId);
        return employee;
    }

    @Override
    public List<TDemoEmployee> employeeAdd(TDemoEmployee employee) throws Exception {
        employee.setOperTime(new Timestamp(System.currentTimeMillis()));
        employeeMapper.employeeAdd(employee);
        List<TDemoEmployee> employeeList = employeeMapper.employeeQueryAllSql("");
        return employeeList;
    }

    @Override
    public List<TDemoEmployee> employeeUpd(TDemoEmployee employee) throws Exception {
        employee.setOperTime(new Timestamp(System.currentTimeMillis()));
        employeeMapper.employeeUpd(employee);
        List<TDemoEmployee> employeeList = employeeMapper.employeeQueryAllSql("");
        return employeeList;
    }

    @Override
    public List<TDemoEmployee> employeeDel(String... employeeIds) throws Exception {
        employeeMapper.employeeDel(employeeIds);
        List<TDemoEmployee> employeeList = employeeMapper.employeeQueryAllSql("");
        return employeeList;
    }

}
